package com.ly.heart.service.impl;

import java.util.List;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import org.springframework.stereotype.Service;
import com.ly.heart.mapper.ProjectRelationMapper;
import com.ly.heart.domain.ProjectRelationEntity;
import com.ly.heart.service.IProjectRelationService;

import javax.annotation.Resource;

/**
 * 项目关系人Service业务层处理
 * @author cxl
 * @date 2024-05-14
 */
@Service
public class ProjectRelationServiceImpl implements IProjectRelationService {

    @Resource
    private ProjectRelationMapper projectRelationMapper;

    /**
     * 查询项目关系人
     * @param id 项目关系人主键
     * @return 项目关系人
     */
    @Override
    public ProjectRelationEntity selectProjectRelationEntityById (String id) {
        return projectRelationMapper.selectProjectRelationEntityById ( id );
    }

    /**
     * 查询项目关系人列表
     * @param projectRelationEntity 项目关系人
     * @return 项目关系人
     */
    @Override
    public List<ProjectRelationEntity> selectProjectRelationEntityList (ProjectRelationEntity projectRelationEntity) {
        return projectRelationMapper.selectProjectRelationEntityList ( projectRelationEntity );
    }

    /**
     * 新增项目关系人
     * @param projectRelationEntity 项目关系人
     * @return 结果
     */
    @Override
    public int insertProjectRelationEntity (ProjectRelationEntity projectRelationEntity) {
        projectRelationEntity.setId ( SnowflakeIdWorker.getInstance ().nextStringId () );
        projectRelationEntity.setCreateTime ( DateUtils.getNowDate () );
        return projectRelationMapper.insertProjectRelationEntity ( projectRelationEntity );
    }

    /**
     * 修改项目关系人
     * @param projectRelationEntity 项目关系人
     * @return 结果
     */
    @Override
    public int updateProjectRelationEntity (ProjectRelationEntity projectRelationEntity) {
        return projectRelationMapper.updateProjectRelationEntity ( projectRelationEntity );
    }

    /**
     * 批量删除项目关系人
     * @param ids 需要删除的项目关系人主键
     * @return 结果
     */
    @Override
    public int deleteProjectRelationEntityByIds (String[] ids) {
        return projectRelationMapper.deleteProjectRelationEntityByIds ( ids );
    }

    /**
     * 删除项目关系人信息
     * @param id 项目关系人主键
     * @return 结果
     */
    @Override
    public int deleteProjectRelationEntityById (String id) {
        return projectRelationMapper.deleteProjectRelationEntityById ( id );
    }
}
